<template>
    <div class="community">
      <div class="header">
        <div class="title">社区</div>
        <div class="search-bar">
          <input type="text" placeholder="搜索">
          <button>搜索</button>
        </div>
      </div>
      <div class="post-list">
        <div v-for="post in posts" :key="post.id" class="post">
          <div class="post-header">
            <img :src="post.userAvatar" alt="user-avatar" width="50px">
            <div class="user-info">
              <div class="username">{{ post.username }}</div>
              <div class="post-time">{{ post.time }}</div>
            </div>
          </div>
          <div class="post-content">{{ post.content }}</div>
          <div class="post-actions">
            <button>点赞</button>
            <button>评论</button>
            <button>分享</button>
          </div>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        posts: [
          {
            id: 1,
            username: '陈小鹿',
            userAvatar: 'https://tse1-mm.cn.bing.net/th/id/OIP-C.bA499tRLX7J5XJWMhs77hQAAAA?rs=1&pid=ImgDetMain',
            time: '1小时前',
            content: '分享一首歌曲 1.1-鹿晗'
          },
          {
            id: 2,
            username: '——',
            userAvatar: 'https://tse2-mm.cn.bing.net/th/id/OIP-C._MwTNTwf60UUCXItO_7tOAAAAA?rs=1&pid=ImgDetMain',
            time: '2小时前',
            content: '分享一首歌曲 All Night-(G)I-DLE'
          },
          {
            id: 3,
            username: '芸',
            userAvatar: 'https://tse1-mm.cn.bing.net/th/id/OIP-C.Tap7BMzkb9-0-gz9Q0bijQAAAA?rs=1&pid=ImgDetMain',
            time: '3小时前',
            content: '分享一首歌曲 达尔文-林俊杰'
          },
          {
            id: 4,
            username: '冷酷果汁',
            userAvatar: 'https://ts2.cn.mm.bing.net/th?id=OIP-C.PwHLbZIbsGxF2dbe0zOc_QHaHa&w=250&h=250&c=8&rs=1&qlt=90&o=6&dpr=1.5&pid=3.1&rm=2',
            time: '4小时前',
            content: '分享一首歌曲 MY BAG-(G)I-DLE'
          }
        ]
      }
    }
  }
  </script>
  
  <style scoped>
  .community {
    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px;
      background-color: #f5f5f5;
      .title {
        font-size: 20px;
        font-weight: bold;
      }
      .search-bar {
        input {
          padding: 5px;
          margin-right: 5px;
        }
        button {
          padding: 5px 10px;
          background-color: #5cadb8;
          color: #fff;
          border: none;
          cursor: pointer;
        }
      }
    }
    .post-list {
      .post {
        padding: 10px;
        margin-bottom: 10px;
        background-color: #fff;
        .post-header {
          display: flex;
          align-items: center;
          img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
          }
          .user-info {
            .username {
              font-weight: bold;
            }
            .post-time {
              color: #666;
            }
          }
        }
        .post-actions {
          button {
            padding: 5px 10px;
            margin-right: 10px;
            border: 1px solid #ccc;
            cursor: pointer;
          }
        }
      }
    }
  }
  </style>